<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>权限列表</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="/static/css/oksub.css">
	<script type="text/javascript" src="/static/lib/loading/okLoading.js"></script>
</head>
<body class="ok-body-scroll">
<div class="ok-body">
	<div class="layui-row">
		<div class="layui-col-md3">
			<div id="permissionTree"></div>
		</div>
	</div>
</div>
<!--js逻辑-->
<script src="/static/lib/layui/layui.js"></script>
<script>
	layui.use(["element","jquery", "table", "laydate", "tree", "okLayer", "okUtils", "okMock"], function () {
		let table = layui.table;
		let laydate = layui.laydate;
		let tree = layui.tree;
		let okLayer = layui.okLayer;
		let okUtils = layui.okUtils;
		let okMock = layui.okMock;
        let $ = layui.jquery;
		okLoading.close();

		laydate.render({elem: '#startTime', type: "datetime"});
		laydate.render({elem: '#endTime', type: "datetime"});
        initPermissionTree();
		function initPermissionTree() {
			okUtils.ajax("/trees/organ1/", "get", null, true).done(function (response) {
				tree.render({
					elem: '#permissionTree',
					data: response.data,
					showCheckbox: false,
					id: 'demoId1',
					isJump: true,
					click: function (obj) {
					    let data = obj.data;
					    $(window.parent.document).find("#dept_pname").val(data.tree_name);
					    $(window.parent.document).find("#tree_dept").val(data.id);
                        let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index);
					}
				});
			}).fail(function (error) {
				console.log(error)
			});
		}

	});
</script>
</body>
</html>
